<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@include file="/WEB-INF/webpage/common/taglibs.jspf"%>
<!DOCTYPE html>
<html>
<head>
  <title>单号规则列表</title>
  <meta name="decorator" content="list"/>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <html:css  name="iCheck,Validform,jquery-ztree,easy-ui"/>
  <html:js  name="iCheck,Validform,jquery-ztree,easy-ui,public-js"/>
  <style type="text/css">.row{margin:0;}</style>
  <script type="text/javascript" src="${staticPath}/common/js/curdtools_jqgrid_extend.js"></script>
</head>
<body title="单号规则">
<div class="easyui-layout" fit="true" id="cc" style="width:100%;">
	<div data-options="region:'center'" title="单号规则">
		<div style="height: 50%">
			<grid:grid id="billRuleGridId" url="${adminPath}/sys/billrule/ajaxList" isAuto="false" scrollpage="true"
				dbUrl="${adminPath}/sys/billrule/{id}" multiselect="false" onSelectRow="selectRow">
				<grid:column label="sys.common.key" hidden="true"  name="id" width="100"/>
			    <grid:column label="业务规则编号"  name="number" query="true" condition="like"/>
			    <grid:column label="业务规则名称"  name="name" query="true" condition="like"/>
			    <grid:column label="是否允许断号"  name="isSnapNo"  dict="sf"/>
			    <grid:column label="业务单据"  name="menuName" />
			    <grid:column label="备注信息"  name="remarks" />
				<grid:column label="sys.common.opt"  name="opt" formatter="button" width="100"/>
				<%-- <shiro:hasPermission name="sys:billrule:update "> --%>
				<grid:button title="sys.common.update"  groupname="opt" function="rowDialog" outclass="btn-success"
					  innerclass="fa-file-text-o" url="${adminPath}/sys/billrule/\"+row.id+\"/update" />
				<%-- </shiro:hasPermission>
				<shiro:hasPermission name="sys:billrule:create"> --%>
				<grid:toolbar function="create_" title="新增" url="${adminPath}/sys/billrule/create" 
					btnclass="btn-fa-plus" icon="fa-plus" winwidth="50%" winheight="60%"/>
				<%-- </shiro:hasPermission>
				<shiro:hasPermission name="sys:billrule:delete"> --%>
				<grid:toolbar function="delete"/>
				<%-- </shiro:hasPermission> --%>
				
				<grid:toolbar function="search"/>
				<grid:toolbar function="reset"/>
			</grid:grid>
		</div>
		<div style="height: 50%">
			<grid:grid id="billRuleDetailGridId" url="${adminPath}/sys/billruledetail/ajaxList" isAuto="false" scrollpage="true"
				dbUrl="${adminPath}/sys/billruledetail/{id}" sortable="true" sortname="sort">
			<grid:column label="sys.common.key" hidden="true"   name="id" width="100"/>
		    <grid:column label="规则Id"  name="fid" hidden="true"/>
		    <grid:column label="规则类型"  name="ruleType" dict="ruleType"/>
		    <grid:column label="固定值"  name="value" align="center"/>
		    <grid:column label="时间戳格式 "  name="dateFormat" dict="dateFormat" align="center"/>
		    <grid:column label="随机数类型"  name="randomType" dict="randomType" align="center"/>
		    <grid:column label="长度"  name="length" align="center"/>
		    <grid:column label="排序 "  name="sort" align="center"/>
		    <grid:column label="步长"  name="step" align="center"/>
		    <grid:column label="补位方式"  name="coverType" dict="coverType" align="center"/>
		    <grid:column label="补位值"  name="coverValue" align="center"/>
		    <grid:column label="是否分隔"  name="isSeparator"  dict="sf" align="center"/>
		    <grid:column label="分隔符"  name="separator" align="center"/>
		    <grid:column label="初始值"  name="initialValue" align="center"/>
		    <grid:column label="自定义sql"  name="customSql" />
		    <grid:column label="参数字段"  name="paramFeild" />
		    <grid:column label="备注信息"  name="remarks" />
			<grid:column label="sys.common.opt"  name="opt" formatter="button" width="100"/>
			<%-- <shiro:hasPermission name="sys:billruledetail:update "> --%>
				<grid:button title="sys.common.update"  groupname="opt" function="rowDialog" outclass="btn-success"
					  innerclass="fa-file-text-o" url="${adminPath}/sys/billruledetail/\"+row.id+\"/update" />
			<%-- </shiro:hasPermission>
			<shiro:hasPermission name="sys:billruledetail:create"> --%>
				<grid:toolbar function="createDetail" title="新增" url="${adminPath}/sys/billruledetail/create" 
					btnclass="btn-fa-plus" icon="fa-plus" winwidth="60%" winheight="70%"/>
			<%-- </shiro:hasPermission>
			<shiro:hasPermission name="sys:billruledetail:delete"> --%>
				<grid:toolbar function="delete"/>
			<%-- </shiro:hasPermission> --%>
			
		</grid:grid>
		</div>
	</div>
</div>
<script type="text/javascript">
var fid = null;//单号规则
var cgridId = 'billRuleDetailGridIdGrid';//明细grid

function create_(title,url,gridId,width,height){
	var menuId = window.localStorage? localStorage.getItem("nid"): Cookie.read("nid");
	url = url + '?menuId='+menuId;
	create(title,url,gridId,width,height)
}

/**
 * @description 行选中 .<br> 
 * @date 2018/8/9 .<br> 
 * @author zcg .<br> 
 */
function selectRow(id){
	fid = id;
	search(cgridId,{fid:fid});
}

/**
 * @description 创建明细 .<br> 
 * @date 2018/8/9 .<br> 
 * @author zcg .<br> 
 */
function createDetail(title,url,gridId,width,height){
	if(!fid){
		layer.msg('请选择一条业务单据',{icon:3,time:1000});
		return;
	}
	url = url + '?fid='+fid;
	create(title,url,gridId,width,height);
}

</script>
</body>
</html>